<?php
namespace Common\Models;
use Common\BaseModel;
class ArticleFaquan extends BaseModel
{
    public $res;
    public $key;
    public function initialize()
    {
        parent::initialize();
        $this->setSource('f_article_faquan');
    }

    /**
     * 获取具体的内容
     * @param int $cid 栏目id
     * @param int $cateid 分类id
     * @param int $is_recommend 是否首页推荐
     * @return mixed
     */
    public function find_list($params){
        $page = isset($params['page']) ? intval($params['page']) : 0;
        $size = isset($params['limit']) ? intval($params['limit']) : 10;
        if ($page > 0) {
            $page = ($page - 1) * $size;
        }
        $conditions="cateid={$params['cid']}";
        $order="id DESC";
        $user_list['items'] = $this::find(
            array(
                $conditions,
                "order" => $order,
                'limit' => $size,
                'offset' => $page
//                "columns"=>"id,itempic,content,itemid",
            )
        )->toarray();
        return $user_list;
    }





    /**
     * 获取具体的内容
     * @param int $cid 栏目id
     * @param int $cateid 分类id
     * @param int $is_recommend 是否首页推荐
     * @return mixed
     */
    public function find_list_new($cid,$params=[]){
        $page = intval($params['page']);
        $size = intval($params['page_size']);
        if ($page > 0) {
            $page = ($page - 1) * $size;
        }
        $conditions="cateid={$cid}";
        $order="id DESC";
        $user_list = $this::find(
            array(
                $conditions,
                "order" => $order,
                'limit'   => $size,
                'offset'  => $page
            )
        )->toarray();
        return $user_list;
    }
    
    


    public function find_first_by_itemid($itemid){
        $res=$this->findFirstByItemid($itemid);
        if($res){
            return	true;
        }else{
            return false;
        }
    }





}
